import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { environment } from '@env/environment';

import { ACLGuard } from '@delon/acl';
import { SessionRouteGuard } from '@core/abp/auth/auth-route-guard';

// layout
import { LayoutDefaultComponent } from '../layout/default/default.component';
import { LayoutFullScreenComponent } from '../layout/fullscreen/fullscreen.component';
import { LayoutPassportComponent } from '../layout/passport/passport.component';

// single pages
import { CallbackComponent } from './callback/callback.component';
import { Exception403Component } from './exception/403.component';
import { Exception404Component } from './exception/404.component';
import { Exception500Component } from './exception/500.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { RoleComponent } from './roles/role.component';
import { EditionComponent } from './editions/editions.component';
import { UsersComponent } from './users/users.component';
import { PaySettingComponent } from './paySettings/pay-settings.component';
import { SmsCodeSettingComponent } from './smsCodeSettings/sms-code-settings.component';
import { StorageSettingComponent } from './storageSettings/storage-settings.component';
import { MiniProgramSettingComponent } from './miniProgramSettings/mini-program-settings.component';
import { AudiLogComponent } from './auditLogs/audi-log.component';
import { MaintenanceComponent } from './maintenance/maintenance.component';
import { CloumnComponent } from './cloumns/cloumns.component';
import { ArticleSourceComponent } from './articleSource/article-source.component';
import { ArticleComponent } from './articles/article.component';

const routes: Routes = [
  {
    path: '',
    component: LayoutDefaultComponent,
    children: [
      { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
      {
        path: 'dashboard',
        component: DashboardComponent,
        data: { title: '首页' } /*canActivate: [SessionRouteGuard]*/,
      },
      {
        path: 'editions',
        component: EditionComponent,
        data: { title: '版本列表' } /*, canActivate: [SessionRouteGuard] */,
      },
      {
        path: 'role',
        component: RoleComponent,
        data: { title: '角色' } /*, canActivate: [SessionRouteGuard] */,
      },
      {
        path: 'users',
        component: UsersComponent,
        data: { title: '用户管理' },
      },
      {
        path: 'audi-log',
        component: AudiLogComponent,
        data: { title: '审计日志' },
      },
      {
        path: 'maintenance',
        component: MaintenanceComponent,
        data: { title: '维护' },
      },
      {
        path: 'pay-setting',
        component: PaySettingComponent,
        data: { title: '支付配置' },
      },
      {
        path: 'sms-code-setting',
        component: SmsCodeSettingComponent,
        data: { title: '短信配置' },
      },
      {
        path: 'storage-setting',
        component: StorageSettingComponent,
        data: { title: '存储配置' },
      },
      {
        path: 'mini-program-setting',
        component: MiniProgramSettingComponent,
        data: { title: '小程序配置' },
      },
      {
        path: 'column',
        component: CloumnComponent,
        data: { title: '栏目信息' },
      },
      {
        path: 'article-source',
        component: ArticleSourceComponent,
        data: { title: '文章来源' },
      },
      {
        path: 'article',
        component: ArticleComponent,
        data: { title: '文章信息'}
      },
    ],
  },
  // passport
  {
    path: 'passport',
    loadChildren: './passport/passport.module#PassportModule',
  },
  // { path: 'users', loadChildren: './users/users.module#UsersModule', canLoad: [ ACLGuard ], data: { guard: 'Pages.Users' } },
  //{ path: 'tenants', loadChildren: './tenants/tenants.module#TenantsModule', canLoad: [ ACLGuard ], data: { guard: 'Pages.Tenants' } },
  // { path: 'roles', loadChildren: './roles/roles.module#RolesModule', canLoad: [ ACLGuard ], data: { guard: 'Pages.Roles' } },
  // 单页不包裹Layout
  { path: 'callback/:type', component: CallbackComponent },
  { path: '403', component: Exception403Component },
  { path: '404', component: Exception404Component },
  { path: '500', component: Exception500Component },
  { path: '**', redirectTo: '404' },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class RouteRoutingModule {}
